﻿﻿@model IEnumerable<Role>

    <thead>
        <tr>
            <th></th>
            <th>
                @Html.DisplayNameFor(model => model.RoleName)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Description)
            </th>
            
        </tr>
    </thead>
    <tbody>
        @foreach (var item in Model)
        {

            <tr>
                <td>                  
                    <!-- Split button -->
                    <div class="btn-group">
                        <button type="button" class="btn btn-primary">操作</button>
                        <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                            <span class="caret"></span>
                            <span class="sr-only">Toggle Dropdown</span>
                        </button>
                        <ul class="dropdown-menu">              
                           
                                @if (!item.IsSys)
                                {
                                    <li>
                                        @Ajax.RawActionLink("<i class='fa fa-edit fa-fw'></i>编辑",
                        "EditRole", "Role",
                        new { id = item.Id },
                        new AjaxOptions { HttpMethod = "Get", UpdateTargetId = "edit-container", OnComplete = "onAjaxComplete" },
                        new { title = "编辑角色" })
                                    </li>
                                }


                                   
                            <li>
                                @Ajax.RawActionLink("<i class='fa fa-user-secret fa-fw'></i>权限",
                        "SetRoleMenus", "Role",
                        new { id = item.Id },
                        new AjaxOptions { HttpMethod = "Get", UpdateTargetId = "menus-container", OnComplete = "onAjaxCompleteRoleMenus" },
                        new { title = "编辑权限" })
                               
                            </li>                        
                      @if (!item.IsSys)
                      {
                        <li>
                            <a href="@Url.Action("Delete", new { id = item.Id })" data-confirm="你确定要删除此 @item.RoleName 吗？" class="delete-item" data-toggle="tooltip" data-placement="top" title="删除">
                                <i class="fa fa-trash-o fa-fw"></i> 删除
                            </a>
                        </li>
                      }
                       
                    </ul>
                </div>

                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.RoleName) 
                    @if (item.IsSys)
                    {
                        <span class="badge badge-primary">系统</span>
                    }
                    
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Description)
                </td>
       
            </tr>
        }
    </tbody>
